﻿using System;
using System.Web;
using System.Web.UI.WebControls;
using DomainModel;
using Services.Abstract;

namespace Web
{
    public partial class Site : BaseMasterPage
    {
        public IUserService UserService { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void LoginName1_OnInit(object sender, EventArgs e)
        {
            User user = UserService.GetUserByLogin(HttpContext.Current.User.Identity.Name);
            if (user != null)
            {
                ((LoginName)sender).FormatString = user.UserProfile.Fio;
            }
        }

        protected void LoginStatus1_OnLoggingOut(object sender, LoginCancelEventArgs e)
        {
            UserService.SignOut();

            Response.Redirect("/Login.aspx");
        }
    }
}